//
//  MyLikeCell.m
//  Tang
//
//  Created by lanou on 15/12/9.
//  Copyright © 2015年 352324497@qq.com. All rights reserved.
//

#import "MyLikeCell.h"
#define KFontSize (20 * KWidth / 414 )
#define Kspace  (10* KWidth / 414)
#define KcellWid (KWidth - Kspace * 2)
#define  labHei  (20 * KWidth / 320)

@interface MyLikeCell()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *myIcon;
@end
@implementation MyLikeCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.selectionStyle = NO;
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.myIcon = [[UIImageView alloc] init];
        
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_myIcon];
        
    }
    return self;
}

- (void)setContentWithNsstring:(NSString *)string imageUrl:(NSString *)imageUrl width:(NSInteger)width height:(NSInteger)height
{
    CGFloat heightTitle = [CallTool heightWithLabel:_titleLabel ForNSStringWithString:string width:KcellWid fontSize:KFontSize space:6];
    self.titleLabel.frame = CGRectMake(Kspace, 0, KcellWid, heightTitle);
    
    [self.myIcon sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"place"]];
    self.myIcon.frame = CGRectMake(Kspace, self.titleLabel.height, KcellWid, KcellWid / width * height);
    
    
    
}
+ (CGFloat)heightForRowWithString:(NSString *)string width:(NSInteger)width height:(NSInteger)height
{
    return [CallTool heightForNSStringWithString:string width:KcellWid fontSize:KFontSize space:Kspace] + KcellWid / width * height + 2* Kspace;
}

@end
